import requests

from utils.SendMethod import SendMethod


class Event:
    def __init__(self):
        self.url = "http://127.0.0.1:8000"

    def add_event(self, body):
        url = self.url + "/api/add_event/"
        return SendMethod.send_method("post", url=url, data=body)

    def get_event(self, params):
        url = self.url + "/api/get_event_list/"
        return SendMethod.send_method("get", url=url, params=params)


if __name__ == '__main__':
    body = {
        "eid": "7999",
        "name": "雨过天晴",
        "limit": "20",
        "status": "1",
        "address": "武汉源码时代",
        "start_time": "2022-07-25"
    }
    print(Event().add_event(body))
    params = {
        "eid": "7999",
        "name": "雨过天晴"
    }
    print(Event().get_event(params))
